package com.miniportal.base.controller;



import cn.hutool.http.HttpStatus;
import com.miniportal.base.convert.BillingInformationConvert;
import com.miniportal.base.pojo.CommonResponse;
import com.miniportal.base.pojo.dto.BillingInformationDto;
import com.miniportal.base.service.IBillingInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 开票信息接口
 * @author zhouje
 * @since 2022-05-30
 */
@RestController
@RequestMapping("billing")
public class BillingInformationController {

    @Autowired
    private IBillingInformationService billingInformationService;

    @GetMapping("queryBillings")
    public CommonResponse queryBillings() {
        return CommonResponse.builder().code(HttpStatus.HTTP_OK).data(BillingInformationConvert.INSTANCE.dosToDtos(billingInformationService.selectAll())).build();
    }

    @PostMapping("addOne")
    public CommonResponse addOne(BillingInformationDto request) {
        return CommonResponse.builder().code(HttpStatus.HTTP_OK).msg("操作成功").data(billingInformationService.save(BillingInformationConvert.INSTANCE.dtoToDo(request))).build();
    }

}
